package com.kye.express.business.deposit.viewholder;

import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.kye.express.R;
import com.kye.express.databinding.ItemDepositRechargeBinding;
import com.kye.model.bean.deposit.ResultShowPaymentRecordBean;

import me.drakeet.multitype.ItemViewBinder;

/**
 * 预存运费-充值记录 ViewHolder
 * <p>
 * Created by SkyYu on 2018/1/17
 */
public class DepositRechargeItemViewBinder extends ItemViewBinder<ResultShowPaymentRecordBean.DatasBean, DepositRechargeItemViewBinder.ViewHolder> {

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View view = inflater.inflate(R.layout.item_deposit_recharge, parent, false);
        return new ViewHolder(view);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull ResultShowPaymentRecordBean.DatasBean item) {
        holder.bindData(item);
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        private ResultShowPaymentRecordBean.DatasBean data;
        private ItemDepositRechargeBinding dataBinding;

        public ViewHolder(View itemView) {
            super(itemView);
            dataBinding = DataBindingUtil.bind(itemView);
        }

        public void bindData(ResultShowPaymentRecordBean.DatasBean item) {
            data = item;
            dataBinding.setRecordModel(data);
        }
    }
}